package com.cnxjs.shs4et.controller;

import com.cnxjs.shs4et.common.Result;
import com.cnxjs.shs4et.entity.Like;
import com.cnxjs.shs4et.service.LikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/like")
public class LikeController {

    @Autowired
    private LikeService likeService;

    // 点赞
    @PostMapping("/add")
    public Result like(@RequestBody Like like){
        return likeService.add(like);
    }

    // 取消点赞
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable int id){
        return likeService.delete(id);
    }

}
